package cn.fl.project.transform;

import cn.fl.project.dto.PrjBscInfoDTO;
import cn.fl.project.dto.PrjContBatchMakeDTO;
import cn.fl.project.vo.PrjBscInfoVO;
import cn.fl.project.vo.PrjContBatchMakeVo;
import com.google.common.collect.Lists;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;

import java.util.List;

public class PrjContBatchMakeVoTransform {

    public static PrjContBatchMakeDTO toDTO(PrjContBatchMakeVo dto) {
        PrjContBatchMakeDTO prjContBatchMakeDTO = new PrjContBatchMakeDTO();
        BeanUtils.copyProperties(dto,prjContBatchMakeDTO);
        return prjContBatchMakeDTO;
    }

    public static PrjContBatchMakeVo toVO(PrjContBatchMakeDTO dto) {
        PrjContBatchMakeVo p = new PrjContBatchMakeVo();
        BeanUtils.copyProperties(dto,p);
        return p;
    }

    public static List<PrjContBatchMakeVo> toVOList(List<PrjContBatchMakeDTO> dtos) {
        if(CollectionUtils.isEmpty(dtos)){
            return null;
        }
        List<PrjContBatchMakeVo> list = Lists.newArrayList();
        for (PrjContBatchMakeDTO prjContBatchMakeDTO : dtos) {
            PrjContBatchMakeVo p = new PrjContBatchMakeVo();
            BeanUtils.copyProperties(prjContBatchMakeDTO,p);
            list.add(p);
        }
        return list;
    }

    public static List<PrjContBatchMakeDTO> toDTOList(List<PrjContBatchMakeVo> vos) {
        if(CollectionUtils.isEmpty(vos)){
            return null;
        }
        List<PrjContBatchMakeDTO> list = Lists.newArrayList();
        for (PrjContBatchMakeVo prjContBatchMakeVo : vos) {
            PrjContBatchMakeDTO p = new PrjContBatchMakeDTO();
            BeanUtils.copyProperties(prjContBatchMakeVo,p);
            list.add(p);
        }
        return list;
    }

}
